//
//  LineLayOut.swift
//  lookLikeIweekly
//
//  Created by ZhangXiaoqian on 16/6/12.
//  Copyright © 2016年 Mainzxq. All rights reserved.
//

import UIKit

class LineLayOut: UICollectionViewFlowLayout {
    var itemCount: Int
    
    init(count:Int) {
        self.itemCount = count
        super.init()
        self.itemSize = CGSize(width: 50,height: 25)
        
        self.minimumLineSpacing = 0
        self.minimumInteritemSpacing = 0

        print("linelayout excute")
    
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override func prepareLayout() {
        self.sectionInset = UIEdgeInsetsMake(0, 0, 0, 0)
        self.scrollDirection = UICollectionViewScrollDirection.Horizontal
        
        
        
    }
    
    override func shouldInvalidateLayoutForBoundsChange(newBounds: CGRect) -> Bool {
        return true
    }
    
    override func collectionViewContentSize() -> CGSize {
        return CGSizeMake(50*(CGFloat(itemCount)), 25)
    }

}
